﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Sector7.Restaurant.Modules.BIZZ.Utility;
using Sector7.Restaurant.Modules.BIZZ.LocalService;
using Sector7.Framework.Enums;

namespace Sector7.Restaurant.Modules.BIZZ.Windows
{
    /// <summary>
    /// StockSummaryWindow.xaml 的交互逻辑
    /// </summary>
    public partial class StockSummaryWindow : UserControl
    {
        private List<RS_Unit> _units;
        private List<RS_Metadata> _metadatas;

        public StockSummaryWindow()
        {
            InitializeComponent();
        }

        private void btnPurchase_Click(object sender, RoutedEventArgs e)
        {
            PurchaseWindow purchaseWindow = new PurchaseWindow(_metadatas, _units);
            bool? result = purchaseWindow.ShowDialog();

            if (result == true)
            {

            }
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            _units = Aide.LocalClient.Invoke<List<RS_Unit>>(
                service => service.GetAllUnits());

            _metadatas = Aide.LocalClient.Invoke<List<RS_Metadata>>(
                service => service.GetAllMetadatasForUsage((int)MetadataUsageType.Stock));
        }
    }
}